<%@ page import="MypageController.MyWrite.MyWriteBean" %>
<%@ page import="MypageController.MyMain.MyMainBean" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<% 	request.setCharacterEncoding("UTF-8");

	String you = (String)request.getAttribute("you");
	String id = (String)request.getAttribute("id");
	int level = (Integer)request.getAttribute("level");
	int mypageId = (Integer)request.getAttribute("mypageid");
	int currentpage = (Integer)request.getAttribute("currentPage");

	MyWriteBean entries[] = (MyWriteBean[])request.getAttribute("entries");		
	MyMainBean mypagedata = (MyMainBean)request.getAttribute("mypagedata");
	
	String color;
	if(level == 1){
		color = "#60b615";
	}else{
		color = "#0f89d2";
	}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="/KOMORIUTA/Mypage/Css/MpBord.css"> 
<link rel="STYLESHEET" type="text/css" href="/KOMORIUTA/page/page.css">
<script src="/KOMORIUTA/Massage/Ms_Script.js" type="text/JavaScript"></script>
<script src="/KOMORIUTA/Mypage/Mp_Script.js" type="text/JavaScript"></script>
<script src="/KOMORIUTA/Mypage/jquery.js" type="text/JavaScript"></script>
</head>
<body id="body">
<form id="entries"  method="post" action="/KOMORIUTA/MyMainServ.do">
<input type="hidden" name="action" value="WholeEntries" />
<input type="hidden" name="id" value="<%=id%>"/>
<input type="hidden" name="mypageid" value="<%=mypageId%>"/>
<input type="hidden" id="currentPage" name="currentPage" value = "<%=currentpage%>"/>

<table align="center" width="696" height="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td align="center" width="100%" height="100" background="<%=request.getContextPath() %>/Mypage/image/topskin.jpg" style="border-right: 2px solid <%=color %>; border-bottom: 2px solid <%=color %>">
			<table width="100%"cellpadding="0" cellspacing="0">
				<tr height="20%"><td>&nbsp;</td></tr>
				
				<tr align="center">
					<td width="80%">
						<h1><%=mypagedata.getBlog_Tilte()%></h1>
					</td>
				</tr>
				
				<tr>
					<td align="right" valign="bottom" >
						<%=mypagedata.getBlog_Intro() %>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	
	<tr>
		<td align="right" valign="middle">
			<a href=javascript:startPage("<%=id%>","<%=0%>")>
				<img alt="" src="<%=request.getContextPath() %>/Main/image/Blog_My.png">
			</a>　
			<a href=javascript:entriWrite('<%=id%>',<%=mypageId%>)> 
				<img alt="" src="<%=request.getContextPath() %>/Main/image/Blog_Wr.png">
			</a>　
				<% if(level == 2){ %>
			<a href=javascript:manage('<%=id%>',<%=mypageId%>)>
				<img alt="" src="<%=request.getContextPath() %>/Main/image/Blog_Ad.png">
			</a>
				<% } %>
		</td>
	</tr>
	
</table>
<% if(entries.length == 0){ %>
<div id="list">
	<div id="board">
    	<div class="content"><h3>まだ作成した文がありません。</h3></div>
  	</div>
</div>
<% }else{
		for(int i = 0;i < entries.length; i++){
			int count = 0;
%>
<div id="list">
	<div id="board">
    	<h2><a href=javascript:page("<%=id%>","<%=entries[i].getEnt_Number()%>","<%=entries[i].getID()%>") class="redB" ><%=entries[i].getEnt_Title()%></a></h2>
    	<%if(entries[i].getEnt_Nick().equals(id)){%><label id="settle"><a href=javascript:entriModify("<%=id%>","<%=entries[i].getID() %>","<%=mypageId%>") class="black"><img alt="" src="<%=request.getContextPath() %>/Main/image/Blog_Re.png"></a>   | <a href=javascript:entriDelet("<%=id%>","<%=entries[i].getID() %>","<%=mypageId%>") class="black"><img alt="" src="<%=request.getContextPath() %>/Main/image/Blog_Dl.png"></a></label><% } %>
    		<div class="content"><%=entries[i].getEnt_Contents() %></div>
			<p align="right" class="base">by <%if(entries[i].getEnt_Nick().equals(id)){%><%=entries[i].getEnt_Nick() %><%}else{%><a href=javascript:WriteGo("<%=id%>","<%=entries[i].getEnt_Nick()%>") class="black"><%=entries[i].getEnt_Nick()%></a><%}%>  | 
	  			<a href=javascript:kategori("<%=id%>","<%=mypageId%>","<%=entries[i].getEnt_Kategorie()%>") class="black"><% if(entries[i].getEnt_Kategorie().equals("")){%>分類無<%}else{%><%=entries[i].getEnt_Kategorie()%><%} %></a> | <a href=javascript:kategoriDate("<%=id%>","<%=mypageId%>","<%=entries[i].getEnt_Date()%>") class="black"><%=entries[i].getEnt_DateString()%></a> | 
				<a href=javascript:commentView("<%=entries[i].getID()%>") class="black">덧글<label class="<%=entries[i].getID()%>">(<%=entries[i].getEnt_ComCount()%>)</label></a>
			</p>
				<div id="fild<%=entries[i].getID()%>" class="feedback" >
					<table width="100%" style="margin-left: 2em;">
						<tr>
							<td align="center" >
								<input class="nick" type="hidden" readonly="readonly" value="<%=id%>">
								<span id="check<%=entries[i].getID()%>" class="warning"><img src="/KOMORIUTA/Mypage/image/erro.png" width="20" height="20" />内容を書いて下さい。</span><br />
								<textarea class="textarea<%=entries[i].getID()%>" style="height:80px; width:500px; border: 1px solid <%=color %>"></textarea>
							</td>
							<td width="100%" align="left">
								<input type="button" class="btn_text1" onclick="commentWrite(<%=mypageId%>, <%=entries[i].getID()%>)" >
							</td>
						</tr>
					</table>
				</div>
	</div>
</div>
<%		}
	} %>
</form>
<table width="100%">
	<tr align="center">
		<td><%=request.getAttribute("paging") %></td>
	</tr>
</table>
</body>
</html>